import request from '@/utils/request'
import qs from 'qs'

export function add(name, subName, pic, shortOrder, show) {
    return request({
        url: '/api/category/add.do',
        method: 'post',
        data: qs.stringify({
            name,
            subName,
            pic,
            shortOrder,
            show
        })
    })
}

export function update(id, name, subName, parentId, pic, shortOrder, show) {
    return request({
        url: '/api/category/update.do',
        method: 'post',
        data: qs.stringify({
            id,
            name,
            subName,
            parentId,
            pic,
            shortOrder,
            show
        })
    })
}

export function list() {
    return request({
        url: '/api/category/list.do',
        method: 'get'
    })
}

export function del(id) {
    return request({
        url: '/api/category/delete.do',
        method: 'get',
        params: {
            id
        }
    })
}

export default list